{% extends 'base.html' %}
{% load static %}

{% block title %}创建故事 - AI故事生成系统{% endblock %}

{% block extra_css %}
<link href="{% static 'django_ckeditor_5/dist/styles.css' %}" type="text/css" media="all" rel="stylesheet">
{% endblock %}

{% block content %}
<div class="container mt-4">
    <div class="row justify-content-center">
        <div class="col-md-10">
            <div class="card">
                <div class="card-header" style="display: flex; justify-content: space-between">
                    <div><h2 class="mb-0">创建新故事</h2></div>
                    <div><a href="{% url 'story:generate' %}" class="btn btn-success"><span class="bi bi-magic me-1">AI生成故事</span> </a></div>

                </div>
                <div class="card-body">
                    <form method="post">
                        {% csrf_token %}
                        {% for field in form %}
                        <div class="mb-3">
                            <label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
                            {{ field }}
                            {% if field.help_text %}
                            <div class="form-text">{{ field.help_text }}</div>
                            {% endif %}
                            {% if field.errors %}
                            <div class="alert alert-danger mt-1">
                                {{ field.errors }}
                            </div>
                            {% endif %}
                        </div>
                        {% endfor %}
                        <div class="d-flex justify-content-between">
                            <button type="submit" class="btn btn-primary">保存故事</button>
                            <a href="{% url 'story:list' %}" class="btn btn-secondary">返回列表</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}

{% block extra_js %}
<script src="{% static 'django_ckeditor_5/dist/bundle.js' %}"></script>
{% endblock %} 